package com.capri.base;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.PersistableBundle;

import androidx.annotation.Nullable;

import com.capri.app.NurseHomeApp;

import cc.cloudist.acplibrary.ACProgressConstant;
import cc.cloudist.acplibrary.ACProgressFlower;

public abstract class BaseActivity extends Activity {

    ACProgressFlower dialog;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        NurseHomeApp.getInstance().addActivity(this);
        initDialog();
        setupView();
        setupData();
    }

    private void initDialog(){
        dialog = new ACProgressFlower.Builder(this).bgAlpha(0)
                .direction(ACProgressConstant.DIRECT_CLOCKWISE)
                .themeColor(Color.WHITE)
                        .fadeColor(Color.TRANSPARENT).build();
        dialog.setCanceledOnTouchOutside(true);
    }

    public void showDialog(){
        dialog.show();
    }

    public void hideDialog(){
        dialog.dismiss();
    }

    public abstract int getLayoutId();

    public abstract void setupView();

    public abstract void setupData();
}
